package com.gary.cmakejniapplication;

import android.os.Environment;
import android.util.Log;

public class Utils {
    public String savePath = "oldpath";
    public static String TAG = "Utils";

    Utils(){}

    public static  String getDiskCacheDir()
    {
        String filePath = null;
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
                || !Environment.isExternalStorageRemovable()) {
            filePath = MainActivity.context.getExternalFilesDir(null).getAbsolutePath();
        } else {
            filePath = MainActivity.context.getFilesDir().getAbsolutePath();
        }
        return filePath;
    }

    public static String getDiskFilesDir()
    {
        String cachePath = null;
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
                || !Environment.isExternalStorageRemovable()) {
            cachePath = MainActivity.context.getExternalCacheDir().getAbsolutePath();
        } else {
            cachePath = MainActivity.context.getCacheDir().getAbsolutePath();
        }
        return cachePath;
    }

    public void SetSavePath(String str)
    {
        savePath = str;
        Log.d(TAG, "SetSavePath: new path is : "+savePath);
    }
}
